package com.taobao.txc.resourcemanager.a.b;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.parser.struct.TxcTable;
import com.taobao.txc.parser.struct.k;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Savepoint;
import java.sql.Statement;

public class g<T>
  extends a<T>
{
  private static final LoggerWrap b = LoggerInit.logger;
  
  public g(com.taobao.txc.resourcemanager.b.a.a parama, com.taobao.txc.resourcemanager.b.a.d paramd, com.taobao.txc.resourcemanager.b.b.a.a<T> parama1, com.taobao.txc.parser.b.a.g paramg)
  {
    super(parama, paramd, parama1, paramg);
  }
  
  public T a(Object... paramVarArgs)
  {
    com.taobao.txc.parser.b.a.e locale = (com.taobao.txc.parser.b.a.e)c();
    com.taobao.txc.resourcemanager.b.a.a locala = a();
    com.taobao.txc.resourcemanager.b.a.d locald = b();
    Connection localConnection = locala.b();
    Statement localStatement = locald.f();
    k localk = com.taobao.txc.parser.b.b.a.a(locale, locala);
    if (localConnection.getAutoCommit() == true) {
      throw new SQLException("txc ReadCommited level should set autocommit false first.");
    }
    ResultSet localResultSet1 = null;
    ResultSet localResultSet2 = null;
    Savepoint localSavepoint = null;
    com.taobao.txc.resourcemanager.a.e locale1 = new com.taobao.txc.resourcemanager.a.e();
    try
    {
      String str1 = locale.k() + " LOCK IN SHARE MODE";
      localSavepoint = localConnection.setSavepoint();
      localResultSet2 = localStatement.executeQuery(str1);
      TxcTable localTxcTable = new TxcTable();
      localTxcTable.a(localk);
      localTxcTable.b(localk.b());
      localTxcTable.c(localk.i());
      localTxcTable.a(localk.a());
      String str2 = locale.g() + locale.d((com.taobao.txc.resourcemanager.b.a.d)null);
      localTxcTable.a(locala, str2);
      String str3 = locala.a(localTxcTable);
      locala.a(locald, str3, locale);
      localResultSet1 = localStatement.executeQuery(locale.d(localTxcTable));
      localConnection.releaseSavepoint(localSavepoint);
      if (localResultSet2 != null) {
        localResultSet2.close();
      }
    }
    catch (com.taobao.txc.common.b.d locald1)
    {
      localConnection.rollback(localSavepoint);
      locale1.a(locald1);
      localConnection.releaseSavepoint(localSavepoint);
      if (localResultSet2 != null) {
        localResultSet2.close();
      }
    }
    catch (Throwable localThrowable)
    {
      b.a("AT mode ", localThrowable.getMessage(), localThrowable);
      throw new SQLException(localThrowable);
    }
    finally
    {
      localConnection.releaseSavepoint(localSavepoint);
      if (localResultSet2 != null) {
        localResultSet2.close();
      }
    }
    return localResultSet1;
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.resourcemanager.a.b.g
 * JD-Core Version:    0.7.0.1
 */